
#include <BSixdofConstraint>
#include "member_BSixdofConstraint.h"

using namespace BWE;

#define member						(*(member_BSixdofConstraint*)_ptr)
#define member_allocate()			_ptr = new member_BSixdofConstraint(this)
#define member_release()			delete (member_BSixdofConstraint*)_ptr

BSixdofConstraint::BSixdofConstraint()
{
	member_allocate();
}
BSixdofConstraint::BSixdofConstraint(BNode* nodeA, const BVector& pointA, const BVector& axisA) : BConstraint(nodeA, pointA, axisA)
{
	member_allocate();
}
BSixdofConstraint::BSixdofConstraint(BNode* nodeA, BNode* nodeB) : BConstraint(nodeA, nodeB)
{
	member_allocate();
}
BSixdofConstraint::BSixdofConstraint(BNode* nodeA, const BVector& pointA, BNode* nodeB, const BVector& pointB) : BConstraint(nodeA, pointA, nodeB, pointB)
{
	member_allocate();
}
BSixdofConstraint::~BSixdofConstraint()
{
	member_release();
}

void BSixdofConstraint::setLinearUpperLimit(BReal lux, BReal luy, BReal luz)
{
	setLinearUpperLimit(BVector(lux, luy, luz));
}
void BSixdofConstraint::setLinearUpperLimit(const BVector& upperLimit)
{
	if (member.linearUpperLimit != upperLimit)
	{
		member.linearUpperLimit = upperLimit;
		this->emit(Signal_Changed);
	}
}
const BVector& BSixdofConstraint::linearUpperLimit() const
{
	return member.linearUpperLimit;
}

void BSixdofConstraint::setLinearLowerLimit(BReal llx, BReal lly, BReal llz)
{
	setLinearLowerLimit(BVector(llx, lly, llz));
}
void BSixdofConstraint::setLinearLowerLimit(const BVector& lowerLimit)
{
	if (member.linearLowerLimit != lowerLimit)
	{
		member.linearLowerLimit = lowerLimit;
		this->emit(Signal_Changed);
	}
}
const BVector& BSixdofConstraint::linearLowerLimit() const
{
	return member.linearLowerLimit;
}

void BSixdofConstraint::setAngularUpperLimit(BReal aux, BReal auy, BReal auz)
{
	setAngularUpperLimit(BVector(aux, auy, auz));
}
void BSixdofConstraint::setAngularUpperLimit(const BVector& upperLimit)
{
	if (member.angularUpperLimit != upperLimit)
	{
		member.angularUpperLimit = upperLimit;
		this->emit(Signal_Changed);
	}
}
const BVector& BSixdofConstraint::angularUpperLimit() const
{
	return member.angularUpperLimit;
}

void BSixdofConstraint::setAngularLowerLimit(BReal alx, BReal aly, BReal alz)
{
	setAngularLowerLimit(BVector(alx, aly, alz));
}
void BSixdofConstraint::setAngularLowerLimit(const BVector& lowerLimit)
{
	if (member.angularLowerLimit != lowerLimit)
	{
		member.angularLowerLimit = lowerLimit;
		this->emit(Signal_Changed);
	}
}
const BVector& BSixdofConstraint::angularLowerLimit() const
{
	return member.angularLowerLimit;
}

void BSixdofConstraint::solve()
{

}
